<template>
	<div class="Precentbrowing clear">
		<Pheader class="tou" msg="最近浏览"></Pheader>
		<ul class="list">
			<collectRenct v-for="(peo,index) in list " :key = "index" :index="peo.id" :fruitName="peo.name" 
			:fruitCon="peo.detail" :fruitPrice="peo.price" :fruitImg="imgSrc[index]"></collectRenct>
		</ul>
	</div>
</template>

<script>
	//头部小组件
	import Pheader from "@/components/P_header.vue";
	// 引入收藏小组件
	import collectRenct from "@/components/collectRenct.vue";
	export default {
		components: {
			Pheader,
			collectRenct
		},
		data() {
			return {
				imgSrc:[],
				list:[],
				indexs:null
			}
		},
		mounted() {
			// var _this = this;
			// // var url = "http://localhost:3000";
			// this.$axios({
			// 	method: 'post',
			// 	url: 'http://localhost:3000/recentlook/pa',
			// 	headers: {
			// 		'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
			// 	},
			// }).then((response) => {
			// 	_this.list = response.data.result;
			// 	_this.code = response.data.code;
			// 	window.console.log(_this.list);
			// 	window.console.log('-------');
			// 	for(var i=0; i < _this.list.length; i++){
			// 		this.imgSrc.push( require('../assets/images/'+response.data.result[i].pricter)) ;
			// 		window.console.log(this.imgSrc);
			// 	}
			// }).catch(function(error) {
			// 	_this.data = error;
			// 	window.console.log(error)
			// });
			var _this = this;
			// var url = "http://localhost:3000";
			this.$axios({
				method: 'post',
				url: 'http://localhost:3000/recentlook/pa',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
			}).then((response) => {
				_this.list = response.data.result;
				_this.code = response.data.code;
				window.console.log(_this.list);
				for (var i = 0; i < _this.list.length; i++) {
					this.imgSrc.push(require('../assets/images/' + response.data.result[i].pricter));
				}
			}).catch(function(error) {
				_this.data = error;
			});
		},
		
		methods: {
			
		}

	}
</script>

<style>
 .Precentbrowing {
  width: 100%;
  /* height: 488px; */
  border: 1px solid #e7e7e7;
  /* margin-left:1%; */
  /* position: absolute;
  top: 0px;
  left: 0px; */
  background: #fff;
}
  .tou{
  padding: 12px 13px;
  border-bottom: 1px solid #e7e7e7;
}
</style>
